<template>
    <h3>{{ pForm.title }}</h3>
    <div id="section">
        <bDetail :instance="pForm" class="form" title="预约人信息" cover="80%"></bDetail>
        <bDetail :instance="pForm" label_prop="labels_info" class="form" title="订单信息" cover="80%"></bDetail>
        <div class="blank"></div>
        <div v-if="pForm.data.status === NURSING_APPOINTMENT_STATUS.已分配">
            <ElButton type="primary" :plain="true" v-if="but.has('nursing_appointment:depart')"
                @click="() => pForm.depart()">
                {{ but.get('nursing_appointment:depart') || '出发' }}</ElButton>
        </div>
        <div v-else-if="pForm.data.status === NURSING_APPOINTMENT_STATUS.已出发">
            <ElButton type="primary" :plain="true" v-if="but.has('nursing_appointment:arrive')"
                @click="() => pForm.arrive()">
                {{ but.get('nursing_appointment:arrive') || '到达' }}</ElButton>
        </div>
        <div v-else-if="pForm.data.status === NURSING_APPOINTMENT_STATUS.已到达">
            <ElButton type="primary" :plain="true" v-if="but.has('nursing_appointment:nursing')"
                @click="() => pForm.nursing()">
                {{ but.get('nursing_appointment:nursing') || '开始' }}</ElButton>
        </div>
        <div v-else-if="pForm.data.status === NURSING_APPOINTMENT_STATUS.护理中">
            <ElButton type="primary" :plain="true" v-if="but.has('nursing_appointment:complete')"
                @click="() => pForm.complete()">
                {{ but.get('nursing_appointment:complete') || '完成' }}</ElButton>
        </div>
    </div>
</template>

<script lang="ts" setup>
import bDetail from "@/components/public/b_detail.vue";
import { IForm } from "@b/index/nursing_appointment";
import { useRoute } from "vue-router";
import { pagebuttonStore } from "@b/store";
import { ElButton } from "element-plus";
import { NURSING_APPOINTMENT_STATUS } from "@b/model/enum";

const pForm = new IForm();
const id = useRoute().query.id;
pForm.id = Number(id);
const but = pagebuttonStore().button;
pForm.url.info = '/nursing_appointment/info/nurse';
pForm.setData();
pForm.init();
</script>

<style scoped>
:deep(.el-dialog) {
    width: 90%;
    max-width: 780px;
}

.edit {
    position: absolute;
    top: 20px;
    right: 20px;
}
</style>
